<?php
namespace Home\Widget;
use Think\Controller;
/**
 * 注册工具类
 * add by xz at 2015-03-18
 */
class UserNavWidget extends Controller {
    
	/**
	 * @param int $type (1.资料完善 2.成为技客)
	 */
    public function nav( $type ) {
    	$this->type = $type;
        $this->display('Widget/User/index_nav');
    }
	public function left(){
		$uid=session('uid');
		//先根据现在的登录用户判断哪些徽章是亮的
		
		//技能认证徽章，如果有技能故事 用户谋生技能则亮
		$u_gskill=M('user_lifeskill')->where('uid='.$uid)->find();
		$is_light_gskill = $u_gskill['status'];
		$this->is_light_gskill = $is_light_gskill;
		if($is_light_gskill){
			$umedal['jn']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/ljn.png';
		}else{
			$umedal['jn']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/ajn.png';
		}
		//用户头像徽章，如果有头像且不是默认头像
		$u_picture = get_user_head($uid);
		if($u_picture==C('UPYUN_URL').C('UPYUN_HEAD').C('UPYUN_CUSTOMVERSION6')){$u_picture=FALSE;}
		$is_light_touxiang =  $u_picture;
		$this->is_light_touxiang = $is_light_touxiang;
		if( $is_light_touxiang ){
			$umedal['xx']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/lxx.png';
		}else{
			$umedal['xx']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/axx.png';
		}
		//实名认证徽章   userauth表中  idcard有值则认证
		$u_idcard = M('user_id_photo')->where('uid='.$uid)->getField('status');
		$is_light_shiming =  $u_idcard;
		$this->is_light_shiming = $is_light_shiming;
		if( $is_light_shiming ){
			$umedal['sm']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/lsm.png';
		}else{
			$umedal['sm']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/asm.png';
		}
		//参与活动徽章 useractivitytemp表中 signstatus 有签到则认证通 
		$signstatus = M('useractivitytemp')->where('uid='.$uid)->getField('signstatus');
		//signstatus状态：1未签到2正常签到3空降
		if(intval($signstatus)==2 || intval($signstatus)==3){
			$umedal['hd']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/lhd.png';
			$this->is_light_activity=true;
		}else{
			$umedal['hd']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/ahd.png';	
		}
		//获取接客身份 apply_jk表中存在uid 则通过认证
		$apply = M('apply_jk')->where(array('uid'=>$uid))->find();
		if($apply && intval($apply['status'])==1){
			$umedal['jk']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/ljk.png';
		}else{
			$umedal['jk']=__ROOT__.'/Public/' . MODULE_NAME . '/images/user/ajk.png';	
		}
		
		$this->assign('umedal',$umedal);
		$this->display('Widget/User/index_left');
	}
}